package com.itheima.d7_stream;

import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class StreamTest2 {
    public static void main(String[] args) {
        List<String> names =new ArrayList<>();
        Collections.addAll(names,"张三","李四","王五");
        Stream<String> stream = names.stream();
        System.out.println(stream.collect(Collectors.toList()));

        Set<String> set =new HashSet<>();
        Collections.addAll(set,"张三","李四","王五");
        Stream<String> stream1 =set.stream();
        stream1.filter(s->s.contains("三")).forEach(a->System.out.println(a));

        Map<String,Double> map =new HashMap<>();
        map.put("张三",100.0);
        map.put("李四",200.0);
        Stream<Map.Entry<String,Double>> stream2 = map.entrySet().stream();
        System.out.println(stream2.collect(Collectors.toMap(e->e.getKey(),e->e.getValue())));

        String[] names1 ={"张三","李四","王五"};
        Stream<String> s1 =Arrays.stream(names1);
        Stream<String> s2 =Stream.of(names1);
}}
